package com.android.fragmentdemo
import android.os.Bundle
import com.android.fragmentdemo.adapters.StudyLayoutManagerAdapter
import com.hengfoxwolf.commonbase.base.BaseActivity
import com.android.fragmentdemo.databeans.DataFactoryIp
import com.android.fragmentdemo.databinding.ActivityStudyLayoutManagerBinding
import com.android.fragmentdemo.definervlayoutmanager.StudyLayoutManager2

class StudyLayoutManagerActivity : BaseActivity<ActivityStudyLayoutManagerBinding>() {

    override fun getLayoutId(): Int = R.layout.activity_study_layout_manager

    override fun init(savedInstanceState: Bundle?) {
        val mAdapter = StudyLayoutManagerAdapter()
        mAdapter.itemDataSet = DataFactoryIp.createStrDataSet()
        //Log.d("TAG","itemCount00:${mAdapter.itemDataSet?.size}")
        //Log.d("TAG","itemCount00:${mAdapter.itemDataSet?.get((mAdapter.itemDataSet?.size ?: 0) - 1)}")
        val margins = this@StudyLayoutManagerActivity.resources.getDimension(R.dimen.dp_5).toInt()
        mBinding.rvStudy.apply {
            layoutManager = StudyLayoutManager2(margins)
            adapter = mAdapter
        }
    }
}